//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.lyq.bean.mySql;

import com.lyq.bean.Course;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;

public class SeekAllC_Sql {
    public SeekAllC_Sql() {
    }

    public List<Course> seekAllC_Sql(List<Course> list) {
        (new MysqlLinking()).getLink();
        Connection conn = MysqlLinking.conn;
        if (conn != null) {
            try {
                String sql = "select * from course ";
                PreparedStatement ps = conn.prepareStatement(sql);
                ResultSet rs = ps.executeQuery();

                while(rs.next()) {
                    Course c = new Course();
                    c.setNo(rs.getString("C_No"));
                    c.setName(rs.getString("C_Name"));
                    c.setTime(rs.getString("C_Time"));
                    c.setPlace(rs.getString("C_Place"));
                    c.setCredit(rs.getString("C_Credit"));
                    c.setTeacher(rs.getString("C_Teacher_ID"));
                    c.setLimitNum(rs.getString("C_LimitNum"));
                    c.setResidueNum(rs.getString("C_ResidueNum"));
                    c.setCourseType(rs.getString("course_type"));
                    c.setCampus(rs.getString("campus"));
                    c.setCategory(rs.getString("category"));
                    // 获取新的课程分类字段
                    String classification = rs.getString("course_classification");
                    if (classification != null) {
                        c.setCourseClassification(classification);
                    }
                    list.add(c);
                }
                
                rs.close();
                ps.close();
            } catch (Exception var7) {
                Exception e = var7;
                e.printStackTrace();
            }
        } else {
            System.out.println("数据库连接错误！");
        }

        return list;
    }
}